#include <iostream>
using namespace std;

class Target 
{
public:
	virtual ~Target() {}
	virtual void perform()=0;
};

class Client 
{
private:
	Target* target;
public:
	Client(Target* target) 
	{
		this->target = target;
	}
	void submit() 
	{
		target->perform();
	}
};

class Adaptee 
{
public:
	void execute()
	{
		cout << "called the adaptee" << endl;
	}
};

class Obj_Adapter: public Target 
{
private:
	Adaptee* adaptee;
public:
	Obj_Adapter(Adaptee* adaptee) 
	{
		this->adaptee = adaptee;
	}
	void perform() 
	{
		cout << "This is running the object adapter." << endl;
		adaptee->execute();
	}
};

class Clz_Adapter: public Target, private Adaptee 
{
public:
	void perform() 
	{
		cout << "This is running the class adapter." << endl;
		this->execute();
	}
};

int main() 
{
	Client* client;
	client = new Client(new Obj_Adapter(new Adaptee()));
	client->submit();

	client = new Client(new Clz_Adapter());
	client->submit();
	return 0;
}
